import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 递归求斐波那契数列的第 N 项
 * User: 15085202591
 * Date: 2022-11-03
 * Time: 21:24
 */
public class Fibonacci {
    private static int Fib(int x){
        if(x == 1 || x == 2)
        {
            return 1;
        }
        return Fib(x-1) + Fib(x-2);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个数字：");
        while (sc.hasNextInt()){
            int n = sc.nextInt();
            System.out.println("斐波拉契数列第"+n+"项为"+Fib(n));
        }
    }
}
